<?php
/* @var $this CountAdminController */
/* @var $model CountAdmin */

$this->breadcrumbs=array(
	'Count Admins'=>array('index'),
	'Create',
);
Yii::app()->clientScript->registerCoreScript('jquery');

$this->menu=array(
    array('label'=>'统计', 'url'=>array('index')),
    array('label'=>'最近30天', 'url'=>array('create')),
    array('label'=>'最近12个月', 'url'=>array('create')),
);
?>
<script type="text/javascript" src="<?php echo Yii::app()->request->baseUrl; ?>/js/highcharts.js"></script>
<h1>Create CountAdmin</h1>
<div id="content" style="width: 100%; height: 500px; margin: 0 auto"></div>
<script type="text/javascript">
    $(function () {
        var colorx = Highcharts.getOptions().colors;
        $('#content').highcharts({
            chart: {
                type: 'column'
            },
            title: {
                text: '最近30天统计'
            },

            xAxis: {
                categories: [<?php foreach ($x as $v) { echo "'".$v."',";} ?>]

            },
            yAxis: {
                min: 0,
                title: {
                    text: '天/量',
                    align: 'high'
                },
                labels: {
                    overflow: 'justify'
                }
            },
            tooltip: {
                valueSuffix: 'ss'
            },
            plotOptions: {
                bar: {
                    dataLabels: {
                        enabled: true
                    }
                }
            },

            credits: {
                enabled: false
            },
            series: [{
                name: '用户总数',
                data: [<?php $ix=0; foreach ($y as $k=>$v) {
                    $ix++;
                    if($ix>9)$ix=0;
                    echo "{color: colorx['1'], y:".$v['users']."},";
                } ?>],
                dataLabels: {
                    enabled: true,
                    rotation: 0,
                    color: '#FFFFFF',
                    align: 'center',
                    x: 6,
                    y: 0,
                    style: {
                        fontSize: '13px',
                        fontFamily: 'Verdana, sans-serif',
                        textShadow: '0 0 1px #FFFFFF'
                    }
                }
            },
                {
                    name: '当天用户数',
                    data: [<?php $ix=0; foreach ($y as $k=>$v) {
                    $ix++;
                    if($ix>9)$ix=0;
                    echo "{color: '#2f7ed8', y:".$v['user_to_day']."},";
                } ?>],dataLabels: {
            enabled: true,
                rotation: 0,
                color: '#2f7ed8',
                align: 'center',
                x: 6,
                y: 0,
                style: {
                fontSize: '13px',
                    fontFamily: 'Verdana, sans-serif',
                    textShadow: '0 0 1px black'
            }
        }
                }]
        });
    });


</script>

